function initPage(baseInfoJson,pressureSoreInfoJson){
	var basePath = $("#basePath").val();
	
	
	
	$("select").each(function(){
		$(this).append("<option value=''>---请选择---</option>");
	});
	var pressureSoreCradles = baseInfoJson['pressureSoreCradles'];//压疮来源
	$(".pressureSoreCradleSelect").each(function(){
		var options = "";
		for(var index in pressureSoreCradles){
			var pressureSoreCradle = pressureSoreCradles[index];
	    	options+="<option value='"+pressureSoreCradle.uniq_code+"'>"+pressureSoreCradle.label+"</option>"
	    } 
       $(this).append(options);
	});
	
	var pressureSorePhases = baseInfoJson['pressureSorePhases'];//压疮分期
	$(".pressureSorePhaseSelect").each(function(){
		var options = "";
		for(var index in pressureSorePhases){
			var pressureSorePhase = pressureSorePhases[index];
	    	options+="<option value='"+pressureSorePhase.uniq_code+"'>"+pressureSorePhase.label+"</option>"
	    } 
       $(this).append(options);
	});
	
	var pressureSoreParts = baseInfoJson['pressureSoreParts'];//压疮部位
	$(".pressureSorePartSelect").each(function(){
		var options = "";
		for(var index in pressureSoreParts){
			var pressureSorePart = pressureSoreParts[index];
	    	options+="<option value='"+pressureSorePart.uniq_code+"'>"+pressureSorePart.label+"</option>"
	    } 
       $(this).append(options);
	});
	
	var pressureSoreRecords = pressureSoreInfoJson['pressureSoreRecords'];//压疮记录明细集合
	for(var index in pressureSoreRecords){
		var pressureSoreRecord = pressureSoreRecords[index];
		var add_content= addPressureSoreRecord();
		add_content.find("input[name$='.occurDateTime']").val(pressureSoreRecord.occurDateTime);
		add_content.find("input[name$='.registerDateTime']").val(pressureSoreRecord.registerDateTime);
		if(pressureSoreRecord.pressureSoreCradleCode){
			var selectOption = add_content.find("select[name$='pressureSoreCradleCode']").find("option[value='"+pressureSoreRecord.pressureSoreCradleCode+"']")
			if(selectOption.length > 0){
				selectOption.attr("selected",true);
			}else{
				add_content.find("select[name$='pressureSoreCradleCode']").append("<option selected='selected' value='"+pressureSoreRecord.pressureSoreCradleCode+"'>"+pressureSoreRecord.pressureSoreCradleName+"</option>");
			}
			
		};
		add_content.find("input[name$='.pressureSoreCradleName']").val(pressureSoreRecord.pressureSoreCradleName);
		
		
		if(pressureSoreRecord.pressureSorePhaseCode){
			var selectOption = add_content.find("select[name$='pressureSorePhaseCode']").find("option[value='"+pressureSoreRecord.pressureSorePhaseCode+"']")
			if(selectOption.length > 0){
				selectOption.attr("selected",true);
			}else{
				add_content.find("select[name$='pressureSorePhaseCode']").append("<option selected='selected' value='"+pressureSoreRecord.pressureSorePhaseCode+"'>"+pressureSoreRecord.pressureSorePhaseName+"</option>");
			}
			
		};
		add_content.find("input[name$='.pressureSorePhaseName']").val(pressureSoreRecord.pressureSorePhaseName);
		
		
		if(pressureSoreRecord.pressureSorePartCode){
			var selectOption = add_content.find("select[name$='pressureSorePartCode']").find("option[value='"+pressureSoreRecord.pressureSorePartCode+"']")
			if(selectOption.length > 0){
				selectOption.attr("selected",true);
			}else{
				add_content.find("select[name$='pressureSorePartCode']").append("<option selected='selected' value='"+pressureSoreRecord.pressureSorePartCode+"'>"+pressureSoreRecord.pressureSorePartName+"</option>");
			}
			
		};
		add_content.find("input[name$='.pressureSorePartName']").val(pressureSoreRecord.pressureSorePartName);
		
	} 
	
	
	
	if($("#pressureSoreRecords tbody tr").length <1){
		addPressureSoreRecord();
	}
}

function addPressureSoreRecord(){
	var basePath = $("#basePath").val();
	var pressureSoreCountOjb = $("#pressureSoreRecordCount");
	var count = parseInt(pressureSoreCountOjb.val());
	var add_content=$("#templatePressureSoreTr").clone();
	add_content.removeAttr("id");
	
	add_content.find("input[name^='pressureSoreRecords[0].']").each(function(){
		var eventObj = $(this);
		eventObj.attr("name",eventObj.attr("name").replace("pressureSoreRecords[0]", "pressureSoreRecords["+count+"]"));
   		
	});
	
	add_content.find("select[name^='pressureSoreRecords[0].']").each(function(){
		var eventObj = $(this);
		eventObj.attr("name",eventObj.attr("name").replace("pressureSoreRecords[0]", "pressureSoreRecords["+count+"]"));
	});
	
	add_content.find("select[class='pressureSoreCradleSelect']").each(function(){
		$(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	add_content.find("select[class='pressureSorePhaseSelect']").each(function(){
		$(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	add_content.find("select[class='pressureSorePartSelect']").each(function(){
		$(this).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
	});
	
	
	$("#pressureSoreRecords tbody").append(add_content);
	pressureSoreCountOjb.val(count +1);
	return add_content;
}

function deletePressureSoreRecord(obj){
	$(obj).parent().parent().remove();
}